package TenoriOn.managers
{
	public class ToneManager
	{
		public function ToneManager()
		{
		}
		
		public var toneFunction:Function=Sin;
		
		private static const _2PI:Number=2*Math.PI;
		private static const _PI:Number=Math.PI;
		
		public static var Triangle:Function=function(x:Number):Number{
			return Math.abs(x%_2PI-_PI)*2/_PI-1;
		}
		
		public static var Sawtooth:Function=function(x:Number):Number{
			return (x%_2PI/_PI-1);
		}
		
		public static var Square:Function=function(x:Number):Number{
			return 1+2*(x%_PI-x%_2PI)/_PI;
		}
		
		public static var Sin:Function=function(x:Number):Number{
			return Math.sin(x);
		}
	}
}